
/**
 * 应用基本信息表单验证
 * @param url
 */
function checkAppForm(id,url,updateUrl){
	 	$("#"+id).validate({
	 		onfocusout: function (element, event) {
	 		    if (event.which === 9 && this.elementValue(element) === "") {
	 		        return;
	 		    } else {
	 		        this.element(element);
	 		    }
	 		},
	 		rules: {
	 			webName: {
		 		    required: true,
		 		    remote:{       //验证用户名是否存在
		               type:"POST",
		               url:url,             
		               data:{webName:function(){
		            	   			return $("#webName").val();
		            	   			},
	 						webNameNow:function(){
		 							if(document.getElementById("webNameNow")!=undefined){
		 								return $("#webNameNow").val();
	 								}else{
	 									return "";
	 								}
	 							},
		               		appId:function(){
			               			if(document.getElementById("appId")!=undefined){
		 								return $("#appId").val();
	 								}else{
	 									return "";
	 								}
		               			}
		               		} 
		              } 
	            },
	            webDomains: {
		 		    required: true
	 		   },
	 		  webRecord: {
		 		    required: true
	 		   },
	 		  appProfile: {
		 		    required: true
	 		   },
	 		  appDescribe: {
		 		    required: true,
	 		   }
 		    },
	        messages: {
	        	webName: {
	        		required: "请输入网站名称",
	        		remote: "应用名已存在"
	        	},
	        	webDomains: {
	        		required: "请输入网站域名",
	        	},
	        	webRecord: {
	        		required: "请输入网站备案信息",
	        	},
	        	appProfile: {
	        		required: "请输入网站简介",
	        	},
	        	appDescribe: {
	        		required: "请输入网站介绍",
	        	}
 		   },
	        submitHandler:function(form){
	        	$(form).ajaxSubmit({
	        		type: "post",
	                url:updateUrl,
	                data:$(form).serialize(),
	                async: false,
	                datatype:"json",
	                success: function(response) {
	                	$("#pl_appConsole").html(response);
	                }
	              });
	        }
	    });
	 	$("#reset").click(function() {
            validator.resetForm();
        });
	};
